import request from '@/utils/request'
 import {   getToken,    setToken,    removeToken  } from '@/utils/auth'

export function api_login(username, password, verificationCodeTag, verificationCode) {
  return request({
    url: '/web/system/user/login',
    method: 'post',
    data: {
      username: username,
      password: password,
      verificationCodeTag: verificationCodeTag,
      verificationCode: verificationCode
    }
  })
}

export function api_register(email, username, password, verificationCodeTag, verificationCode) {
  return request({
    url: '/web/system/user/register',
    method: 'post',
    data: {
      email: email,
      username: username,
      password: password,
      verificationCodeTag: verificationCodeTag,
      verificationCode: verificationCode
    }
  })
}


//验证token是否有效
export function api_verifyToken() {
  var Token = getToken();
  return request({
    url: '/web/system/user/verifyToken',
    method: 'get',
    params: {
      Token
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/vue-admin-template/user/info',
    method: 'get',
    params: {
      token
    }
  })
}
